import React from 'react';
import { Cascader } from 'antd';

export default class CustomCascader extends React.Component {

  data = [{
    code: "1",
    name: "Pos大屏",
    subList: [{
      code: "2",
      name: "测试"
    }]
  }, {
    code: "2",
    name: "PORTAL",
    subList: [{
      code: "90400807578520001",
      name: "正餐订单详情页_结算前_banner广告",
      subList: [{
        code: "1",
        name: "图片",
        subList: []
      }]
    }, {
      code: "90400807578520002",
      name: "堂食订单详情页_结算后_banner广告",
      subList: [{
        code: "1",
        name: "图片",
        subList: []
      }]
    }, {
      code: "90400807578520003",
      name: "外卖订单详情页_结算后_banner广告",
      subList: [{
        code: "1",
        name: "图片",
        subList: []
      }]
    }]
  }, {
    code: "3",
    name: "WALLET",
    subList: [{
      code: "90400807578520007",
      name: "支付确认页广告1",
      subList: [{
        code: "1",
        name: "图片",
        subList: []
      }]
    }, {
      code: "90400807578520008",
      name: "支付确认页广告2",
      subList: [{
        code: "1",
        name: "图片",
        subList: []
      }]
    }, {
      code: "90400807578520009",
      name: "支付完成页广告",
      subList: [{
        code: "1",
        name: "图片",
        subList: []
      }]
    }]
  }]

  onChange = (value) => {
    console.log(value);
  }

  render() {
    const { cascadedata } = this.props;
    return (
      <Cascader allowClear={false} options={cascadedata} onChange={this.onChange} placeholder="Please select" {...this.props}></Cascader>
    );
  }
}
